package servlet;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.JspFragment;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class FragmentTag extends SimpleTagSupport {
	
	private JspFragment fragment;

	public void doTag() throws JspException,IOException {

		
		JspWriter out=getJspContext().getOut();
		
		out.println("<div style='padding:10px;border:1px solid black;border-radius:20px'>");
		out.println("<h1>下边是动态传入的jsp片段</h1>");
		
		//调用，输出“页面片段”(不是getJspBody.invoke(null))
		fragment.invoke(null);
		
		out.println("</div>");
		
		

	}

	public JspFragment getFragment() {
		return fragment;
	}

	public void setFragment(JspFragment fragment) {
		this.fragment = fragment;
	}
	
	
	

}
